<template>
	<div>
		<el-table
		      :data="list"
		      style="width: 100%">
		      <el-table-column
		        prop="realmeritUser__name"
		        label="名称">
		      </el-table-column>
			  <!-- <el-table-column
			    prop="familyusername"
			    label="家庭成员姓名">
			  </el-table-column> -->
		      <el-table-column
		        prop="realmeritUser__mainPhone"
		        label="联系电话">
		      </el-table-column>
			  <el-table-column label="状态" prop="status">
			  	<!-- 0未使用 1已使用 2已过期 -->
			  	<template slot-scope="{row}">
			  		<el-tag v-if="row.status==0">未使用</el-tag>
			  		<el-tag v-if="row.status==1" type="success">已使用</el-tag>
					<el-tag v-if="row.status==2" type="danger">已过期</el-tag>
			  	</template>
			  </el-table-column>
			  <el-table-column label="过期时间" prop="expire_time" align="center" width="180px">
			      <template slot-scope="{ row }">
			          {{ row.expire_time | formatDate }}
			      </template>
			  </el-table-column>
			  <el-table-column label="领取时间" prop="addtime" align="center" width="180px">
			      <template slot-scope="{ row }">
			          {{ row.addtime | formatDate }}
			      </template>
			  </el-table-column>
			 
			  <!-- <el-table-column label="核销码">
			  	<template slot-scope="{row}">
			  		<el-image style="width:60px;height:60px" :src="'https://dtou.app65.cn'+row.activity_code" :preview-src-list="['https://dtou.app65.cn'+row.activity_code]">
			  		</el-image>
			  	</template>
			  </el-table-column> -->
		    </el-table>
			<el-pagination class="main-pagination" :current-page.sync="page" :page-size="limit" :total="total"
			    @current-change="onCurrentChange" layout="total,jumper,prev,pager,next"></el-pagination>
	</div>
	
</template>

<script>
	import { imghttp,get,post,del } from '@/assets/js/http'
	// import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
	export default {
		name: "member-search",
		props: {
			formData: {
				type: Number,
				default: () => 0
			},
		},
		components: {
			// "el-upload-image": () => import("@/components/el-upload-image.vue"),
			// "maps": () => import("@/components/map/index.vue"),
			// Editor,
			// Toolbar
		},
		mounted() {
			this.getlist()
		},
		data() {
			return {
				total:0,
				page:1,
				list:[],
				limit:15,
			};
		},
		beforeDestroy() {
		    // const editor = this.editor;
		    // if (editor == null) return;
		    // editor.destroy();
		},
		methods: {
			onCurrentChange(index) {
			    this.page = index;
			    this.getlist();
			},
			getlist(){
				get({
					url:'/admin/shop.voucher/userVoucher',
					params:{
						id:this.formData,
						limit: this.limit,
						page: this.page
					}
				}).then(res=>{
					this.list = res.list
					this.total = res.total;
				})
			}
		}
	};
</script>
<!-- <style src="@wangeditor/editor/dist/css/style.css"></style> -->
